﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;


namespace geetol.sms.service
{
    public partial class Service1 : ServiceBase
    {
        core.Logs log;
        public static bool isStart = true;

        public Service1()
        {
            log = new core.Logs(GetType().Name);
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            try
            {
                isStart = true;
                core.DbHelperSQL.connectionString = core.config.LoadSqlConnection();
                util.CreateDataTable();
                new task.smsKeMai();
                log.Write("服务启动完成");
            }
            catch(Exception ex)
            {
                log.Write(ex);
                this.Stop();
            }
           
        }

        protected override void OnStop()
        {
            log.Write("服务停止");
            isStart = false;
        }
    }
}
